/* Theme Name: Boomerang - Multipurpose Template Theme URI: https://wrapbootstrap.com/theme/tribus-multipurpose-template-WB0367H15 Author: Webpixels Author URI: http://www.webpixels.io License URI: http://wrapbootstrap.com */ // Growl notifications function notify(title, message, type) { $.growl({ icon: '', title: title, message: message, url: '' }, { element: 'body', type: type, allow_dismiss: true, placement: { from: 'bottom', align: 'center' }, offset: { x: 20, y: 85 }, spacing: 10, z_index: 1031, delay: 2500, timer: 3000, url_target: '_blank', mouse_over: false, animate: { enter: '', exit: '' }, icon_type: 'class', template: '
' }); }; // Background image holder with fullscreen option $(window).on('load resize', function() { // Make the navbar sticky to top when offset is reached ScrollPosStyler.init({ 'scrollOffsetY': $('.navbar').offset().top }); // WPX Slider - Background image holder if ($('.background-image-holder').length) { $('.background-image-holder').each(function() { var $this = $(this); var holderHeight; if ($this.data('holder-type') == 'fullscreen') { if ($this.attr('data-holder-offset')) { if ($this.data('holder-offset')) { var offsetHeight = $('body').find($this.data('holder-offset')).height(); holderHeight = $(window).height() - offsetHeight; } } else { holderHeight = $(window).height(); } if ($(window).width() > 991) { $('.background-image-holder').css({ 'height': holderHeight + 'px' }); } else { $('.background-image-holder').css({ 'height': 'auto' }); } } }) } // Dynamic height taken from data attr if ($(".same-height").length > 0) { $(".same-height").each(function(index, element) { var $this = $(this); var container = $this.data("same-height"); setTimeout(function() { var height = $("body").find(container).height(); if ($(window).width() > 991) { // Set height $this.css({ "height": height + "px" }); } else { // Set height $this.css({ "height": "auto" }); } }, 300); }); } load_swiper(); }); function load_swiper(){ // Swiper if ($(".swiper-js-container").length > 0) { $('.swiper-js-container').each(function(i, swiperContainer) { var $swiperContainer = $(swiperContainer); var $swiper = $swiperContainer.find('.swiper-container'); var swiperEffect = $swiper.data('swiper-effect'); var slidesPerViewXs = $swiper.data('swiper-xs-items'); var slidesPerViewSm = $swiper.data('swiper-sm-items'); var slidesPerViewMd = $swiper.data('swiper-md-items'); var slidesPerViewLg = $swiper.data('swiper-items'); var spaceBetweenSlidesXs = $swiper.data('swiper-xs-space-between'); var spaceBetweenSlidesSm = $swiper.data('swiper-sm-space-between'); var spaceBetweenSlidesMd = $swiper.data('swiper-md-space-between'); var spaceBetweenSlidesLg = $swiper.data('swiper-space-between'); // Slides per view written in data attributes for adaptive resoutions slidesPerViewXs = !slidesPerViewXs ? 1 : slidesPerViewXs; slidesPerViewSm = !slidesPerViewSm ? 1 : slidesPerViewSm; slidesPerViewMd = !slidesPerViewMd ? 1 : slidesPerViewMd; slidesPerViewLg = !slidesPerViewLg ? 1 : slidesPerViewLg; // Space between slides written in data attributes for adaptive resoutions spaceBetweenSlidesXs = !spaceBetweenSlidesXs ? 0 : spaceBetweenSlidesXs; spaceBetweenSlidesSm = !spaceBetweenSlidesSm ? 0 : spaceBetweenSlidesSm; spaceBetweenSlidesMd = !spaceBetweenSlidesMd ? 0 : spaceBetweenSlidesMd; spaceBetweenSlidesLg = !spaceBetweenSlidesLg ? 0 : spaceBetweenSlidesLg; var animEndEv = 'webkitAnimationEnd animationend'; var $swiper = new Swiper($swiper, { pagination: $swiperContainer.find('.swiper-pagination'), nextButton: $swiperContainer.find('.swiper-button-next'), prevButton: $swiperContainer.find('.swiper-button-prev'), slidesPerView: slidesPerViewLg, spaceBetween: spaceBetweenSlidesLg, autoplay: $swiper.data('swiper-autoplay'), effect: swiperEffect, speed: 800, paginationClickable: true, direction: 'horizontal', preventClicks: true, preventClicksPropagation: true, observer: true, observeParents: true, breakpoints: { 460: { slidesPerView: slidesPerViewXs, spaceBetweenSlides: spaceBetweenSlidesXs }, 767: { slidesPerView: slidesPerViewSm, spaceBetweenSlides: spaceBetweenSlidesSm }, 991: { slidesPerView: slidesPerViewMd, spaceBetweenSlides: spaceBetweenSlidesMd }, 1100: { slidesPerView: slidesPerViewLg, spaceBetweenSlides: spaceBetweenSlidesLg } }, onInit: function(s) { var currentSlide = $(s.slides[s.activeIndex]); var elems = currentSlide.find(".animated"); elems.each(function() { var $this = $(this); if (!$this.hasClass('animation-ended')) { var animationInType = $this.data('animation-in'); var animationOutType = $this.data('animation-out'); var animationDelay = $this.data('animation-delay'); setTimeout(function() { $this.addClass('animation-ended ' + animationInType, 100).on(animEndEv, function() { $this.removeClass(animationInType); }); }, animationDelay); } }); }, onSlideChangeStart: function(s) { var currentSlide = $(s.slides[s.activeIndex]); var elems = currentSlide.find(".animated"); elems.each(function() { var $this = $(this); if (!$this.hasClass('animation-ended')) { var animationInType = $this.data('animation-in'); var animationOutType = $this.data('animation-out'); var animationDelay = $this.data('animation-delay'); setTimeout(function() { $this.addClass('animation-ended ' + animationInType, 100).on(animEndEv, function() { $this.removeClass(animationInType); }); }, animationDelay); } }); }, onSlideChangeEnd: function(s) { var previousSlide = $(s.slides[s.previousIndex]); var elems = previousSlide.find(".animated"); elems.each(function() { var $this = $(this); var animationOneTime = $this.data('animation-onetime'); if (!animationOneTime || animationOneTime == false) { $this.removeClass('animation-ended'); } }); } }); }); } } // On document ready functions $(document).ready(function() { // Bootstrap - Submenu event for small resolutions $('.dropdown-menu .dropdown-submenu [data-toggle="dropdown"]').on('click', function(e) { if ($(window).width() < 992) { if (!$(this).next().hasClass('show')) { $(this).parents('.dropdown-menu').first().find('.show').removeClass("show"); } var $subMenu = $(this).next(".dropdown-menu"); $subMenu.toggleClass('show'); $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) { $('.dropdown-submenu .show').removeClass("show"); }); return false; } }); // Fix the closing problem when clicking inside dopdown menu $('.navbar .dropdown-menu').on('click', function(event) { event.stopPropagation(); }); // One page nav $('.navbar-onepage .nav-link').on('click', function(e) { var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 1500, 'easeInOutExpo'); e.preventDefault(); }); // Hamburger if ($('.hamburger-js')[0]) { $(".hamburger-js").each(function() { var $this = $(this); $this.on("click", function(e) { $this.toggleClass("is-active"); // Do something else, like open/close menu }); }); } // $('a[href="#"]').on('click tap', function(e) { // e.preventDefault(); // }); // Footer reveal if ($('[data-toggle="footer-reveal"]').length) { $('[data-toggle="footer-reveal"]').footerReveal({ shadow: false, //zIndex: -101 }); } // Bootstrap selected // $('.selectpicker').each(function(index, element) { // $('.selectpicker').selectpicker({ // style: $(this).data('select-style'), // size: $(this).data('select-size'), // liveSearch: $(this).data('select-live-search'), // mobile: $(this).data('select-mobile') // }); // }); // Datepicker if ($('.datepicker')[0]) { $('.datepicker').each(function() { var $this = $(this); $($this).flatpickr({ inline: $this.data('datepicker-inline') ? $this.data('datepicker-inline') : false, static: true, nextArrow: '', prevArrow: '' }); }) } // Input mask if ($('.input-mask')[0]) { $('.input-mask').mask(); } // NoUI Slider if ($(".input-slider-container")[0]) { $('.input-slider-container').each(function() { var slider = $(this).find('.input-slider'); var sliderId = slider.attr('id'); var minValue = slider.data('range-value-min'); var maxValue = slider.data('range-value-max'); var sliderValue = $(this).find('.range-slider-value'); var sliderValueId = sliderValue.attr('id'); var startValue = sliderValue.data('range-value-low'); var c = document.getElementById(sliderId), d = document.getElementById(sliderValueId); noUiSlider.create(c, { start: [parseInt(startValue)], //step: 1000, range: { 'min': [parseInt(minValue)], 'max': [parseInt(maxValue)] } }); c.noUiSlider.on('update', function(a, b) { //alert(b) d.textContent = a[b]; }); }) } if ($("#input-slider-range")[0]) { var c = document.getElementById("input-slider-range"), d = document.getElementById("input-slider-range-value-low"), e = document.getElementById("input-slider-range-value-high"), f = [d, e]; noUiSlider.create(c, { start: [parseInt(d.getAttribute('data-range-value-low')), parseInt(e.getAttribute('data-range-value-high'))], connect: !0, range: { min: parseInt(c.getAttribute('data-range-value-min')), max: parseInt(c.getAttribute('data-range-value-max')) } }), c.noUiSlider.on("update", function(a, b) { f[b].textContent = a[b]; }), c.noUiSlider.on("change", function(a, b) { $('.min_height').val(a[0]); $('.max_height').val(a[1]); }) } // Bootstrap Carousels $('.carousel').carousel({ interval: 5000, pause: 'hover' }); // Smooth scroll $('.scroll-me').on('click', function(event) { // Animate scroll to the selected section $('html, body').stop(true, true).animate({ scrollTop: $(this.hash).offset().top }, 600); event.preventDefault(); }); $('[data-scroll-to]').on('click', function(event) { var hash = $(this).data('scroll-to'); // Animate scroll to the selected section $('html, body').stop(true, true).animate({ scrollTop: $(hash).offset().top }, 600); event.preventDefault(); }); // To top var offset = 300, //browser window scroll (in pixels) after which the "back to top" link opacity is reduced offset_opacity = 1200, //duration of the top scrolling animation (in ms) scroll_top_duration = 700, //grab the "back to top" link $back_to_top = $('.back-to-top'); //hide or show the "back to top" link $(window).scroll(function() { ($(this).scrollTop() > offset) ? $back_to_top.addClass('back-to-top-is-visible'): $back_to_top.removeClass('back-to-top-is-visible cd-fade-out'); if ($(this).scrollTop() > offset_opacity) { $back_to_top.addClass('back-to-top-fade-out'); } }); //smooth scroll to top $back_to_top.on('click', function(event) { event.preventDefault(); $('body, html').animate({ scrollTop: 0, }, scroll_top_duration); }); // Light gallery if ($('[data-toggle="light-gallery"]').length > 0) { $('[data-toggle="light-gallery"]').lightGallery({ selector: 'this' }); } if ($('.light-gallery').length > 0) { $('.light-gallery').each(function() { var $this = $(this); $this.lightGallery({ selector: '.item', thumbnail: true }); }); } // Isotope // for each container $('.masonry-container').each(function(i, masonryContainer) { var $masonryContainer = $(masonryContainer); // init isotope for container var $masonry = $masonryContainer.find('.masonry').imagesLoaded(function() { // Set default filter if exists var filterMenuItems = $masonryContainer.find('.masonry-filter-menu'); var defaultFilterButton = filterMenuItems.find('.default'); var defaultFilterValue = defaultFilterButton.data('filter'); if (defaultFilterValue != undefined && defaultFilterValue != '') { if (defaultFilterValue != '*') { defaultFilterValue = '.' + defaultFilterValue; } defaultFilterButton.addClass('active'); } $masonry.isotope({ itemSelector: '.masonry-item', filter: defaultFilterValue }) }); // init filters for container $masonryContainer.find('.masonry-filter-menu').on('click', 'a', function() { var filterValue = $(this).attr('data-filter'); if (filterValue == '*') { filterValue = ''; } else { filterValue = '.' + filterValue; } $masonry.isotope({ filter: filterValue }); }); }); $('.masonry-filter-menu').each(function(i, buttonGroup) { var $buttonGroup = $(buttonGroup); $buttonGroup.on('click', 'a', function() { $buttonGroup.find('.active').removeClass('active'); $(this).addClass('active'); }); }); // Swiper var productSwiper; if ($(".product-swiper-container").length > 0) { $(".product-swiper-container").each(function(index, element) { $(this).addClass('s-' + index); $(this).find('.swiper-pagination').addClass('sp-' + index); productSwiper = $('.s-' + index).swiper({ speed: 400, loop: true, grabCursor: true, pagination: '.sp-' + index, paginationClickable: true, centeredSlides: false, preloadImages: false, lazyLoading: true, observer: true, observerParents: true }); }); } if ($(".swiper-container-centered").length > 0) { $(".swiper-container-centered").each(function() { var swiper = new Swiper('.swiper-container-centered', { pagination: '.swiper-pagination', slidesPerView: 'auto', centeredSlides: true, paginationClickable: true, spaceBetween: 30, initialSlide: 1, breakpoints: { // when window width is <= 320px 768: { slidesPerView: 1, spaceBetweenSlides: 0 }, // when window width is <= 480px 991: { slidesPerView: 2, spaceBetweenSlides: 0 } } }); }); } // Swiper gallery if ($(".swiper-gallery").length > 0) { $(".swiper-gallery").each(function() { var galleryTop = new Swiper('.gallery-top', { nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', spaceBetween: 10, }); var galleryThumbs = new Swiper('.gallery-thumbs', { spaceBetween: 10, centeredSlides: false, slidesPerView: 'auto', touchRatio: 0.2, slideToClickedSlide: true }); galleryTop.params.control = galleryThumbs; galleryThumbs.params.control = galleryTop; }); } // Parallax if ($(".paraxify").length > 0) { var myParaxify = paraxify('.paraxify', { speed: 1, boost: 1 }); } // Viewport animations $('.milestone-count').viewportChecker({ callbackFunction: function(elem, action) { setTimeout(function() { $('.milestone-count').countTo({ formatter: function(value, options) { return value.toFixed(options.decimals); }, onUpdate: function(value) { console.debug(this); }, onComplete: function(value) { console.debug(this); } }); }, 500); } }); // Typed JS if ($('.type-this').length > 0) { $('.type-this').each(function() { var element = $(this).attr('id'); var strings = $(this).data('type-this'); strings = strings.split(','); var typed = new Typed('#' + element, { strings: strings, typeSpeed: 100, backSpeed: 70, loop: true }); }) } if ($('.countdown').length > 0) { $('.countdown').each(function() { var $this = $(this); var date = $this.data('countdown-date'); $this.countdown(date).on('update.countdown', function(event) { var $this = $(this).html(event.strftime('' + '